package com.xm.biz.impl;

import com.xm.biz.UserAddressBiz;
import com.xm.dao.UserAddressDao;
import com.xm.dao.impl.UserAddressDaoImpl;
import com.xm.po.UserAddress;

import java.util.List;

/**
 * @author Administrator
 * @date 2020-08-19-9:21
 * @description 用户地址数据操作业务接口实现类
 */
public class UserAddressBizImpl implements UserAddressBiz {
    //初始化数据源
    UserAddressDao userAddressDao=new UserAddressDaoImpl();
    @Override
    public List<UserAddress> list() {
        return userAddressDao.list();
    }

    @Override
    public List<UserAddress> getUserAddress(Integer userId) {
        return userAddressDao.getUserAddress(userId);
    }

    @Override
    public UserAddress getIsDefault(Integer userId) {
        return userAddressDao.getIsDefault(userId);
    }
    /**
     * 删除指定收货地址
     * @param addressId
     * @return
     */
    @Override
    public boolean delete(String addressId) {
        boolean delete = userAddressDao.delete(addressId);
        return delete;
    }
    /**
     * 根据id查询用户地址
     * @param id
     * @return
     */
    @Override
    public UserAddress selectById(Integer id) {
        return userAddressDao.selectById(id);
    }

    /**
     * 修改发货地址信息
     * @param userAddress
     * @return
     */
    @Override
    public boolean update(UserAddress userAddress) {
        boolean update = userAddressDao.update(userAddress);
        return update;
    }
    /**
     * 新增收货地址
     * @param userAddress
     * @return
     */
    @Override
    public boolean add(UserAddress userAddress) {
        boolean add = userAddressDao.add(userAddress);
        return add;
    }
}
